/**
 * @author zhengjiachao
 * @since 2017-3-27
 */

BCP.bill.model.DiagramModel = function(){
    BCP.bill.model.DiagramModel.superclass.constructor.call(this);
    this.children = [];
};

BCP.bill.model.DiagramModel.PROPERTY_BUSINESS_TYPE = "businessType";
BCP.bill.model.DiagramModel.PROPERTY_JS_FILE_PATH="jsFilePath";
BCP.bill.model.DiagramModel.PROPERTY_FORM_NAME="formName";

COM.util.defineClass(BCP.bill.model.DiagramModel, ADF.model.DiagramModel,{
    initModel: function() {
        BCP.bill.model.DiagramModel.superclass.initModel.call(this);
        this.addPropertyDescriptor(new ADF.propertyDescriptor.DefaultPropertyDescriptor(BCP.bill.model.DiagramModel.PROPERTY_FORM_NAME,"","",true, "表单名称"));
        this.addPropertyDescriptor(new BCP.bill.propertyDescriptor.BiztypePropertyDescriptor(BCP.bill.model.DiagramModel.PROPERTY_BUSINESS_TYPE,"","",true, "业务类型"));
        this.addPropertyDescriptor(new ADF.propertyDescriptor.DefaultPropertyDescriptor(BCP.bill.model.DiagramModel.PROPERTY_JS_FILE_PATH,"","",true, "脚本路径", "表相关脚本文件相对于工程根目录的位置"));
        this.removePropertyDescriptor(ADF.model.BaseModel.PROPERTY_ADFTAG);
        this.removePropertyDescriptor(ADF.model.BaseModel.PROPERTY_BORDER);
        this.removePropertyDescriptor(ADF.model.BaseModel.PROPERTY_COLOR);
        this.removePropertyDescriptor(ADF.model.BaseModel.PROPERTY_BACKGROUND);
        this.removePropertyDescriptor(ADF.model.BaseModel.PROPERTY_FONTSIZE);
        this.removePropertyDescriptor(ADF.model.BaseModel.PROPERTY_TITLE);
    },
    

    _getModelType : function(){
        return "BCP.bill.model.DiagramModel";
    },

    fillSerializedJson : function(jsonObject){
        BCP.bill.model.DiagramModel.superclass.fillSerializedJson.call(this, jsonObject);
        jsonObject[BCP.bill.model.DiagramModel.PROPERTY_BUSINESS_TYPE]=this.getPropertyDescriptor(BCP.bill.model.DiagramModel.PROPERTY_BUSINESS_TYPE).serialize();
        jsonObject[BCP.bill.model.DiagramModel.PROPERTY_JS_FILE_PATH]=this.getPropertyDescriptor(BCP.bill.model.DiagramModel.PROPERTY_JS_FILE_PATH).serialize();
        jsonObject[BCP.bill.model.DiagramModel.PROPERTY_FORM_NAME]=this.getPropertyDescriptor(BCP.bill.model.DiagramModel.PROPERTY_FORM_NAME).serialize();
    },

    _deserialize: function(jsonObject) {
        BCP.bill.model.DiagramModel.superclass._deserialize.call(this, jsonObject);
        var newProp = null;
        if(jsonObject[BCP.bill.model.DiagramModel.PROPERTY_FORM_NAME]){
            newProp=new AGEF.PropertyDescriptor();
            newProp.deserialize(jsonObject[BCP.bill.model.DiagramModel.PROPERTY_FORM_NAME]);
            this.propertyDescriptors.put(newProp.getName(),newProp);
        }
        
        if(jsonObject[BCP.bill.model.DiagramModel.PROPERTY_JS_FILE_PATH]){
            newProp=new AGEF.PropertyDescriptor();
            newProp.deserialize(jsonObject[BCP.bill.model.DiagramModel.PROPERTY_JS_FILE_PATH]);
            this.propertyDescriptors.put(newProp.getName(),newProp);
        }
        
        if(jsonObject[BCP.bill.model.DiagramModel.PROPERTY_BUSINESS_TYPE]){
            newProp=new BCP.bill.propertyDescriptor.BiztypePropertyDescriptor();
            newProp.deserialize(jsonObject[BCP.bill.model.DiagramModel.PROPERTY_BUSINESS_TYPE]);
            this.propertyDescriptors.put(newProp.getName(),newProp);
            
        }
        
    }

});
